import java.util.*;

public class MapTest2 {
    public static void main(String[] args) {
        //map存放用户的选择
        Map<String, List<String>> maps = new HashMap<>();
        //单个用户的选择
        List<String> choice1 = new ArrayList<>();
        Collections.addAll(choice1,"A","B","D");
        maps.put("张学友",choice1);
        List<String> choice2 = new ArrayList<>();
        Collections.addAll(choice2,"A","C");
        maps.put("刘德华",choice2);
        List<String> choice3 = new ArrayList<>();
        Collections.addAll(choice3,"B","D");
        maps.put("范志毅",choice3);
        System.out.println(maps);
        System.out.println("---------------------");

        //统计每个景点的人数
        Map<String,Integer> maps2 = new HashMap<>();
        //直接调用api获取所有的值
        for (List<String> value : maps.values()) {
            for (String s : value) {
                if(maps2.containsKey(s)){
                    maps2.put(s, maps2.get(s)+1);
                }else{
                    maps2.put(s,1);
                }
            }
        }
        System.out.println(maps2);
    }
}
